package com.cgq.pro.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.cgq.base.dao.impl.BaseDaoImpl;
import com.cgq.pro.dao.GeneratorDao;
import com.cgq.pro.entity.Generator;

@Repository
public class GeneratorDaoImpl extends BaseDaoImpl<Generator> implements GeneratorDao {

	public Generator findByTableName(String tableName,String prefix) {
		String hql="from Generator o where o.tableName='"+tableName+"' and o.value like '"+prefix+"%'";
		List list=hibernateTemplate.find(hql);
		if(list!=null && list.size()>0){
			return (Generator) list.get(0);
		}else
			return null;
	}
	
}
